package com.huaxin.hxmodulesystem.models.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

/**
 * 审核状态枚举
 */
@Getter
public enum AuditStatus {
    PENDING(0, "待审核"),
    APPROVED(1, "审核通过"),
    REJECTED(2, "审核拒绝");

    @EnumValue  // 👈 标记这个字段是数据库存储的值
    private final Integer value;

    private final String desc;

    AuditStatus(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    // 可选：根据 value 查找枚举（用于业务判断）
    public static AuditStatus of(Integer value) {
        for (AuditStatus status : values()) {
            if (status.value == value) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid AuditStatus value: " + value);
    }
}